Main Tab 1

Column

Column Tab 1

# A tibble: 32,561 × 15
     age workclass   fnlwgt education    education.num marital.status occupation
   <dbl> <chr>        <dbl> <chr>                <dbl> <chr>          <chr>     
 1    90 ?            77053 HS-grad                  9 Widowed        ?         
 2    82 Private     132870 HS-grad                  9 Widowed        Exec-mana…
 3    66 ?           186061 Some-college            10 Widowed        ?         
 4    54 Private     140359 7th-8th                  4 Divorced       Machine-o…
 5    41 Private     264663 Some-college            10 Separated      Prof-spec…
 6    34 Private     216864 HS-grad                  9 Divorced       Other-ser…
 7    38 Private     150601 10th                     6 Separated      Adm-cleri…
 8    74 State-gov    88638 Doctorate               16 Never-married  Prof-spec…
 9    68 Federal-gov 422013 HS-grad                  9 Divorced       Prof-spec…
10    41 Private      70037 Some-college            10 Never-married  Craft-rep…
# ℹ 32,551 more rows
# ℹ 8 more variables: relationship <chr>, race <chr>, sex <chr>,
#   capital.gain <dbl>, capital.loss <dbl>, hours.per.week <dbl>,
#   native.country <chr>, income <chr>

Column Tab 2

Column

Row 1

Row 2

Main Tab 2

Column

1. Plotly for R

Plotly is an R package for creating interactive web-based graphs via plotly’s JavaScript graphing library, plotly.js.

The plotly R package serializes ggplot2 figures into Plotly’s universal graph JSON. plotly::ggplotly will crawl the ggplot2 figure, extract and translate all of the attributes of the ggplot2 figure into JSON (the colors, the axes, the chart type, etc), and draw the graph with plotly.js. Furthermore, you have the option of manipulating the Plotly object with the style function.

2. Cutomizing the Layout

Since the ggplotly() function returns a plotly object, we can manipulate that object in the same way that we would manipulate any other plotly object. A simple and useful application of this is to specify interaction modes, like plotly.js’ layout.dragmode for specifying the mode of click+drag events.

3. Example

library(plotly)
df <- data.frame(x=c(1, 2, 3, 4), y=c(1, 5, 3, 5), group=c('A', 'A', 'B', 'B'))
p <- ggplot(data=df, aes(x=x, y=y, colour=group)) + geom_point()
ggplotly(p)

Column

Row 1

Row 2

Main Tab 3

Column

1. Plotly for R

Plotly is an R package for creating interactive web-based graphs via plotly’s JavaScript graphing library, plotly.js.

The plotly R package serializes ggplot2 figures into Plotly’s universal graph JSON. plotly::ggplotly will crawl the ggplot2 figure, extract and translate all of the attributes of the ggplot2 figure into JSON (the colors, the axes, the chart type, etc), and draw the graph with plotly.js. Furthermore, you have the option of manipulating the Plotly object with the style function.

2. Cutomizing the Layout

Since the ggplotly() function returns a plotly object, we can manipulate that object in the same way that we would manipulate any other plotly object. A simple and useful application of this is to specify interaction modes, like plotly.js’ layout.dragmode for specifying the mode of click+drag events.


---
title: "Adult Census Income"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
    logo: logo.png
    source_code: embed
    social: menu
---

```{r setup, include=FALSE}
library(flexdashboard)
library(tidyverse)
library(plotly)
library(knitr)
library(DT)
df = read_csv('https://bryantstats.github.io/math421/data/adult_census_missing.csv')

# Create a ggplot object
p <- df %>% 
  mutate(income = factor(income)) %>% 
  ggplot()+ 
  geom_bar(mapping=aes(x=sex, fill=income), 
           position = 'fill')+
  labs(y='Proportion', fill='Income')

p1 <- df %>% 
  mutate(sex = factor(income)) %>% 
  ggplot()+ 
  geom_density(mapping=aes(x=age, color=income))+
  facet_wrap(~race)
```

{.sidebar}
=======================================================================

### 1. About Dataset
This data was extracted from the 1994 Census bureau database by Ronny Kohavi and Barry Becker (Data Mining and Visualization, Silicon Graphics). 

```{r}
#add more stuff
```


### 2. Predicting Income
Predict whether income exceeds $50K/yr based on census data

```{r}
#add more stuff
```



Main Tab 1
=======================================================================

Column {data-width=500, .tabset}
-----------------------------------------------------------------------

### Column Tab 1

```{r}
df
```


### Column Tab 2

```{r}
datatable(df, options = list(
  pageLength = 25
))
```


Column {data-width=500}
-----------------------------------------------------------------------

### Row 1

```{r}
#put in different plot but keep income there just change up other variables. also make sure thi one and the other one below arent neededf or compare and contrast ones

# Create a ggplot object
q <- df %>% 
  mutate(income = factor(income)) %>% 
  ggplot()+ 
  geom_bar(mapping=aes(x=sex, fill=income), 
           position = 'fill')+
  labs(y='Proportion', fill='Income')

q1 <- df %>% 
  mutate(sex = factor(income)) %>% 
  ggplot()+ 
  geom_density(mapping=aes(x=age, color=income))+
  facet_wrap(~relationship)
ggplotly(q)

```

### Row 2

```{r}
ggplotly(p)
```


Main Tab 2
=======================================================================

Column {data-width=500}
-----------------------------------------------------------------------

#### 1. Plotly for R

```{r}
#do a compare and contrast
```


Plotly is an R package for creating interactive web-based graphs via plotly's JavaScript graphing library, plotly.js.

The plotly R package serializes ggplot2 figures into Plotly's universal graph JSON. plotly::ggplotly will crawl the ggplot2 figure, extract and translate all of the attributes of the ggplot2 figure into JSON (the colors, the axes, the chart type, etc), and draw the graph with plotly.js. Furthermore, you have the option of manipulating the Plotly object with the style function.


#### 2. Cutomizing the Layout

Since the ggplotly() function returns a plotly object, we can manipulate that object in the same way that we would manipulate any other plotly object. A simple and useful application of this is to specify interaction modes, like plotly.js' layout.dragmode for specifying the mode of click+drag events.


#### 3. Example

```{r, echo=TRUE, eval=TRUE}
library(plotly)
df <- data.frame(x=c(1, 2, 3, 4), y=c(1, 5, 3, 5), group=c('A', 'A', 'B', 'B'))
p <- ggplot(data=df, aes(x=x, y=y, colour=group)) + geom_point()
ggplotly(p)
```



Column {data-width=500}
-----------------------------------------------------------------------

### Row 1

```{r}
p1
```

### Row 2

```{r}
ggplotly(p1)
```

Main Tab 3
=======================================================================

Column {data-width=500}
-----------------------------------------------------------------------

#### 1. Plotly for R

```{r}
#do another compare and contrast or something new with it or show one in depth plot because it is final main tab
```


Plotly is an R package for creating interactive web-based graphs via plotly's JavaScript graphing library, plotly.js.

The plotly R package serializes ggplot2 figures into Plotly's universal graph JSON. plotly::ggplotly will crawl the ggplot2 figure, extract and translate all of the attributes of the ggplot2 figure into JSON (the colors, the axes, the chart type, etc), and draw the graph with plotly.js. Furthermore, you have the option of manipulating the Plotly object with the style function.


#### 2. Cutomizing the Layout

Since the ggplotly() function returns a plotly object, we can manipulate that object in the same way that we would manipulate any other plotly object. A simple and useful application of this is to specify interaction modes, like plotly.js' layout.dragmode for specifying the mode of click+drag events.